package com.yang.newCustomersTransferBackProcess.dao;

import com.yang.newCustomersTransferBackProcess.pojo.ToExamineTransferBack;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ToExamineTransferBackDao extends JpaRepository<ToExamineTransferBack, Integer>, JpaSpecificationExecutor<ToExamineTransferBack> {

    @Query(value = "select tetb.* from to_examine_transfer_back tetb inner join adviser a on tetb.adviser_id = a.id where a.team_id like ?1 and tetb.new_customers_transfer_back_status = ?2", nativeQuery = true)
    List<ToExamineTransferBack> findToExamineTransferBackByRole(String teamId, int newCustomersTransferBackStatus);

//    @Query(value = "select ttb.* from to_examine_transfer_back ttb inner join adviser a on ttb.adviser_id = a.id where a.team_id like ?1 and length(a.team_id) =?2 and ttb.new_customers_transfer_back_status in (?)3", nativeQuery = true)
//    List<ToExamineTransferBack> findToExamineTransferBack(int adviserId, int teamLen, int[] newCustomersTransferBackStatusList);
}
